<?php

namespace app\service\im;

class User extends Base
{
    /**
     * Describe:单个注册用户
     * $userId 用户标识
     * $nick用户昵称
     * $faceUrl 用户头像
     * User: TANGFEN
     */
    public function accountImport($userId, $nick = '', $faceUrl = '')
    {
        $url = $this->url . 'im_open_login_svc/account_import';
        $data = [
            'UserID' => $userId,
            'Nick' => $nick,
            'FaceUrl' => $faceUrl,
        ];
        return $this->common($url, $data);
    }

    /**
     * Describe:批量注册用户
     * $userIds 数组
     * User: TANGFEN
     */
    public function multiaccount_import($userIds)
    {

        $url = $this->url . 'im_open_login_svc/multiaccount_import';
        $data = [
            'Accounts' => $userIds,
        ];
        return $this->common($url, $data);
    }

    /**
     * Describe:添加好友
     * User: TANGFEN
     */
    public function friendAdd($From_Account, $To_Account, $AddSource)
    {

        $url = $this->url . 'sns/friend_add';
        $data = [
            'From_Account' => $From_Account,
            'AddFriendItem' => [
                [
                    'To_Account' => $To_Account,
                    'AddSource' => $AddSource,
//                    'AddSource' => 'Tag_SNS_IM_Remark',
                    'AddWording' => '备注',
                ]
            ],
        ];
        return $this->common($url, $data);
    }

    /**
     * Describe:删除好友
     * User: TANGFEN
     */
    public function delFriend($From_Account, $To_Account)
    {

        $url = $this->url . 'sns/friend_delete';
        $data = [
            'From_Account' => $From_Account,
            'To_Account' => [$To_Account],
            'DeleteType' => 'Delete_Type_Single',//单向删除好友 Delete_Type_Single    //双向删除好友  Delete_Type_Both
        ];
        return $this->common($url, $data);
    }

    /**
     * Describe:添加黑名单
     * User: TANGFEN
     */
    public function blackListAdd($From_Account, $To_Account)
    {

        $url = $this->url . 'sns/black_list_add';
        $data = [
            'From_Account' => $From_Account,
            'To_Account' => [$To_Account],
        ];
        return $this->common($url, $data);
    }

    /**
     * Describe:删除黑名单
     * User: TANGFEN
     */
    public function delBlackList($From_Account, $To_Account)
    {

        $url = $this->url . 'sns/black_list_delete';
        $data = [
            'From_Account' => $From_Account,
            'To_Account' => [$To_Account],
        ];
        return $this->common($url, $data);
    }


}